Add suspenseCallback feature for runtime tracing of loading states#16134
Add suspenseCallback feature for runtime tracing of loading states#16134sebmarkbage merged 1 commit intofacebook:masterfrom
Conversation
|
ReactDOM: size: 0.0%, gzip: 0.0% Details of bundled changes.Comparing: 19354db...448fa2c react-art
react-dom
react-test-renderer
react-reconciler
react-native-renderer
Generated by 🚫 dangerJS |
|
|
||
| if ( | ||
| enableSuspenseCallback && | ||
| 'suspenseCallback' in finishedWork.memoizedProps |
There was a problem hiding this comment.
You can skip this check since it will be implied by the get below.
|
It's not obvious to me why this would break in the persistent renderer (used for RN Fabric). You may have stumbled upon an unrelated bug. |
|
The failure is caused by this line: react/packages/react-reconciler/src/ReactFiberCompleteWork.js Lines 837 to 845 in 9f39590 My vague understanding is that I'm relying on this line to sometimes cause an update incidentally. I need to decide when an update needs to actually happen and trigger it directly. I can fix it by forcing Does that sound right? |
packages/react-reconciler/src/__tests__/ReactSuspenseCallback-test.internal.js
Outdated
Show resolved
Hide resolved
|
Unrelated but I found a bug in the "train model". Because we aggressively mark this for updates, we commit too often which marks the last commit time and pushes out the train model's next commit further than it should. |
|
I think there's a disconnect somewhere. Why do you need the callback to fire after everything has been shown? It doesn't have any promises to give you since it's not waiting on anything. Wouldn't it be fine to just ignore the callback in this case? |
70ae6fc to
74898f6
Compare
|
Applied the suggestions, thanks for the tip on fleshing out the callback behavior. I updated the user code to match with this and I think it looks decent. I'm getting great traces from this. |
|
rebased, should be ready to go. |
This adds a 'SuspenseCallback' feature flag. When the property is set on a suspense component it will be called during the commit phase with a set of the immediate thenable for this component. This will allow user code to build runtime tracing of the cause for a suspense boundary.
|
The build is stuck, but I rebased and retest against FB WWW. |
|
@bgirard do you have any examples of how people use this flag and |
This adds a 'SuspenseCallback' feature flag. When the property is set on
a suspense component it will be called during the commit phase with a
set of the immediate thenable for this component. This will allow user
code to build runtime tracing of the cause for a suspense boundary.
CC @sebmck